#ifndef _LJMU_DX10_BITMAP_H_
#define _LJMU_DX10_BITMAP_H_

#include "util_texture.h"
#include <string>


/************************************
* Class to represent a texture as a
* bitmap sprite.  This class holds the
* buffers for the vertex and index data
* which make up the Quad for the Sprite
* and the information on its position
* on the screen.
*
* AUTHOR:  CHRIS CARTER
*************************************/
class LJMUUtilQuad
{
	//Internal Structures - in this case it is our Vertex Type Declaration
private:
	struct QuadVertexType
	{
		D3DXVECTOR3 screenpos;
	    D3DXVECTOR2 textureuv;
	};

public:
	//--------------CONSTRUCTORS/DESTRUCTORS------------------------------------
	LJMUUtilQuad(): _obj_buff_vertex(NULL),_obj_buff_index(NULL),_obj_dx_texture(NULL){};
	~LJMUUtilQuad(){};

	//--------------ACCESSORS/MUTATORS------------------------------------------
	int							getIndexCount();
	ID3D10ShaderResourceView*	getTexture();

	//--------------PUBLIC METHODS----------------------------------------------
	bool initialise(ID3D10Device* pdevice, int pscreenwidth, int pscreenheight,std::wstring ptexfilename, int pbmpwidth, int pbmpheight);
	void cleanup();
	bool render(ID3D10Device* pdevice, int pposx, int pposy);

protected:
	//--------------PRIVATE METHODS---------------------------------------------
	bool internInitBuffers(ID3D10Device* pdevice);
	void internCleanupBuffers();
	bool internUpdateBuffers(int pposx, int pposy);
	void internRenderBuffers(ID3D10Device* pdevice);
	bool internLoadTextureInMem(ID3D10Device* pdevice,std::wstring ptexfilename);
	void internReleaseTextureFromMem();

protected:
	//--------------INTERNAL FIELDS----------------------------------------------
	ID3D10Buffer*		_obj_buff_vertex;
	ID3D10Buffer*		_obj_buff_index;
	LJMUUtilTexture*	_obj_dx_texture;
	int					_vertex_count;
	int					_index_count;
	int					_screen_width;	
	int					_screen_height;
	int					_bitmap_width;
	int					_bitmap_height;
	int					_prev_pos_x;
	int					_prev_pos_y;
};

#endif